# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=postgresql-hll
pkgver=2.18
pkgrel=0
pkgdesc="PostgreSQL extension adding HyperLogLog data structures as a native data type"
url="https://github.com/citusdata/postgresql-hll"
# armhf,armv7,x86: 32-bit is not supported (error=format)
arch="all !armhf !armv7 !x86"
license="Apache-2.0"
makedepends="postgresql-dev"
subpackages="$pkgname-bitcode"
source="https://github.com/citusdata/postgresql-hll/archive/v$pkgver/postgresql-hll-$pkgver.tar.gz"
options="!check"  # requires running PostgreSQL

build() {
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

bitcode() {
	pkgdesc="$pkgdesc (bitcode for JIT)"
	depends="$pkgname=$pkgver-r$pkgrel"
	install_if="postgresql$(pg_config --major-version)-jit $pkgname=$pkgver-r$pkgrel"

	amove usr/lib/postgresql*/bitcode
}

sha512sums="
0c9aa39ab3abe2e8eba77d2fe190689858d2c49d9b87b25b763c864892a4f1fecab8758ea72616c4bb7446e477850cd95c06e8e8bb5c3a346fa009d26a7f3d44  postgresql-hll-2.18.tar.gz
"
